package com.drought.rained.bean

import com.drought.rained.utils.StringUtilsLJ

import java.io.Serializable

class PayCodeDataLJ : Serializable {

    /**
     * timeSeconds : 21600
     * payCode : [{"permataCode":"8359180605338963"},{"bniCode":""},{"otcCode":"8888859300703407"}]
     */

    var timeSeconds: Int = 0
    var payCode: List<PayCodeBean>? = null

    val payCodeBean: PayCodeBean?
        get() {
            if (mPayCodeBean == null) {
                if (payCode == null || payCode!!.size == 0) {
                    return null
                }
                mPayCodeBean = PayCodeBean()
                for (i in payCode!!.indices) {
                    val payCodeBean = payCode!![i]
                    if (!StringUtilsLJ.isEmpty(payCodeBean.bniCode)) {
                        mPayCodeBean!!.bniCode = payCodeBean.bniCode
                    }

                    if (!StringUtilsLJ.isEmpty(payCodeBean.otcCode)) {
                        mPayCodeBean!!.otcCode = payCodeBean.otcCode
                    }

                    if (!StringUtilsLJ.isEmpty(payCodeBean.permataCode)) {
                        mPayCodeBean!!.permataCode = payCodeBean.permataCode
                    }
                }
            }
            return mPayCodeBean
        }

    private var mPayCodeBean: PayCodeBean? = null


    class PayCodeBean : Serializable {
        /**
         * permataCode : 8359180605338963
         * bniCode :
         * otcCode : 8888859300703407
         */

        var permataCode: String? = null
        var bniCode: String? = null
        var otcCode: String? = null

        companion object {
            private const val serialVersionUID = 2155955367801251379L
        }
    }
}
